package jdbc;

import java.sql.*;

public class Test4 {
    public static void main(String[] args) {
        try (Connection connection = DBUtil.getConnection()){
            String sql = "SELECT id, title, content FROM article";

            Statement statement = connection.createStatement();
            ResultSet rs = statement.executeQuery(sql);
            while(rs.next()) {
                System.out.println(rs.getInt("id")+"《"+rs.getString("title") + "》:" + rs.getString("content"));
            }
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
    }
}
